//
//  WillReleasedTableViewCell.m
//  MyMovie
//
//  Created by lanou3g on 15/9/17.
//  Copyright (c) 2015年 HeQiangQiang. All rights reserved.
//

#import "WillReleasedTableViewCell.h"

@implementation WillReleasedTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self addView];
    }
    return self;
}

- (void)addView
{
    self.moviePic = [[UIImageView alloc] initWithFrame:CGRectMake(3 * kFitWidth, 4 * kFitHeight, 85 * kFitWidth, 115 * kFitHeight)];
//    self.moviePic.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:self.moviePic];
    
    self.movieName = [[UILabel alloc] initWithFrame:CGRectMake(91 * kFitWidth, 10 * kFitHeight, 150 * kFitWidth, 60 * kFitHeight)];
    self.movieName.numberOfLines = 0;
//    self.movieName.backgroundColor = [UIColor orangeColor];
    self.movieName.font = [UIFont boldSystemFontOfSize:18.0* kFitHeight];
    self.movieName.textColor = [UIColor orangeColor];
    [self.contentView addSubview:self.movieName];
    
    self.movieOriginalName = [[UILabel alloc] initWithFrame:CGRectMake(91 * kFitWidth, 65 * kFitHeight, 150 * kFitWidth, 25 * kFitHeight)];
//    self.movieOriginalName.backgroundColor = [UIColor redColor];
    self.movieOriginalName.font = [UIFont systemFontOfSize:14.0* kFitHeight];
    self.movieOriginalName.textColor = [UIColor whiteColor];
    [self.contentView addSubview:self.movieOriginalName];
    
//    self.movieWish = [[UILabel alloc] initWithFrame:CGRectMake(91 * kFitWidth, 65 * kFitHeight, 150 * kFitWidth, 25 * kFitHeight)];
////    self.movieWish.backgroundColor = [UIColor redColor];
//    self.movieWish.font = [UIFont systemFontOfSize:14.0* kFitHeight];
//    self.movieWish.textColor = [UIColor whiteColor];
//    [self.contentView addSubview:self.movieWish];
    
    self.moviePubDate = [[UILabel alloc] initWithFrame:CGRectMake(91 * kFitWidth, 94 * kFitHeight, 200 * kFitWidth, 25 * kFitHeight)];
//    self.moviePubDate.backgroundColor = [UIColor redColor];
    self.moviePubDate.font = [UIFont systemFontOfSize:14.0* kFitHeight];
    self.moviePubDate.textColor = [UIColor whiteColor];
    [self.contentView addSubview:self.moviePubDate];
    
    self.movieCollection = [[UILabel alloc] initWithFrame:CGRectMake(kWidth - (155 * kFitWidth), 10 * kFitHeight, 150 * kFitWidth, 40 * kFitHeight)];
//    self.movieCollection.backgroundColor = [UIColor redColor];
    self.movieCollection.textAlignment = NSTextAlignmentRight;
    self.movieCollection.font = [UIFont systemFontOfSize:14.0* kFitHeight];
    self.movieCollection.textColor = [UIColor redColor];
    [self.contentView addSubview:self.movieCollection];
    
    self.collectionButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.collectionButton.frame = CGRectMake(kWidth - (75 * kFitWidth), 80 * kFitHeight, 30 * kFitWidth, 30 * kFitHeight);
//    self.collectionButton.backgroundColor = [UIColor redColor];
    [self.collectionButton setBackgroundImage:[UIImage imageNamed:@"uncollected"] forState:(UIControlStateNormal)];
    [self.collectionButton setBackgroundImage:[UIImage imageNamed:@"collected"] forState:(UIControlStateSelected)];
    [self.contentView addSubview:self.collectionButton];
    
    UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, 125 * kFitHeight, kWidth, 1)];
    lineView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:lineView];
}

// 设置界面的信息
- (void)setViewWithImageName:(NSString *)imageName title:(NSString *)title movieOriginalName:(NSString *)movieOriginalName pubDate:(NSString *)pubDate collection:(NSNumber *)collection
{
    [self.moviePic sd_setImageWithURL:[NSURL URLWithString:imageName]];
    self.movieName.text = title;
    self.movieOriginalName.text = [NSString stringWithFormat:@"原名：%@",movieOriginalName];
    self.moviePubDate.text = [NSString stringWithFormat:@"上映时间：%@",pubDate];
    self.movieCollection.text = [NSString stringWithFormat:@"%@人已收藏",collection];
}

// button设置点击方法
- (void)setButtonClickWithTarget:(id)target action:(SEL)action
{
    [self.collectionButton addTarget:target action:action forControlEvents:(UIControlEventTouchUpInside)];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
